
* ========================================================= *
*                   Divided loyalties?						*
*  The role of national IO staff in aid-funded procurement  *
*     			  Author : Mirko Heinzel					*
*            		 Version: 13.12.2021                    *
*             		      Stata 16.2                        *
* ========================================================= *


*install packages if needed
*ssc install sum2docx
*net install reghdfe

cd "file destination"

use "Heinzel_procurement.dta"

*-----------------------*
*     Main Article:     *
*-----------------------*

***********************************
* Table 1: Descriptive statistics *
***********************************
sum2docx local_company home_country corr_proc ca_admin_capacity pr_admin_capacity log_price log_amount using table1.docx if home_country!=., stats(N mean sd min max)

*******************************
* Table 1: National suppliers *
*******************************

reghdfe local_company home_country , absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m1, title()

reghdfe local_company home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m2, title()

reghdfe local_company home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id sector_year loan_type) vce(cluster ttl_project_id)
estimates store m3, title()

reghdfe local_company home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id sector_year cntry_year loan_type) vce(cluster ttl_project_id)
estimates store m4, title()

estfe . m1 m2 m3 m4, labels(ttl_id "TTL fixed effects" sector_year "Sector-year fixed effects" loan_type "Loan-type fixed effects")

esttab m1 m2 m3 m4 using Gov1.rtf, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(4) ///
se r2 label  indicate(`r(indicate_fe)') 

**********************
* Table 2: Red flags *
**********************

reghdfe corr_proc home_country  , absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m5, title()

reghdfe corr_proc home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m6, title()

reghdfe corr_proc home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id sector_year loan_type) vce(cluster ttl_project_id)
estimates store m7, title()

reghdfe corr_proc home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id cntry_year sector_year loan_type) vce(cluster ttl_project_id)
estimates store m8, title()

estfe . m5 m6 m7 m8, labels(ttl_id "TTL fixed effects" sector_year "Sector-year fixed effects" loan_type "Loan-type fixed effects")

esttab m5 m6 m7 m8 using Gov2.rtf, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(4) ///
se r2 label  indicate(`r(indicate_fe)') 

************************
* Table 3: Interaction *
************************

reghdfe local_company corr_proc##home_country  , absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m9, title(Clogit)

reghdfe local_company corr_proc##home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m10, title(Clogit)

reghdfe local_company corr_proc##home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id sector_year loan_type) vce(cluster ttl_project_id)
estimates store m11, title(Clogit)

reghdfe local_company corr_proc##home_country ca_admin_capacity pr_admin_capacity log_price log_amount  , absorb(ttl_id sector_year cntry_year loan_type) vce(cluster ttl_project_id)
estimates store m12, title(Clogit)

estfe . m9 m10 m11 m12, labels(ttl_id "TTL fixed effects" sector_year "Sector-year fixed effects" loan_type "Loan-type fixed effects")

esttab m9 m10 m11 m12 using Gov3.rtf, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(4) ///
se r2 label  indicate(`r(indicate_fe)') 

*-------------------------*
*        Appendix:        *
*-------------------------*

***********************************
* Table A2: Short-bidding periods *
***********************************

reghdfe corr_submp home_country , absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m13, title()

reghdfe corr_submp home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id sector_year loan_type) vce(cluster ttl_project_id)
estimates store m14, title()

reghdfe local_company corr_submp##home_country  , absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m15, title()

reghdfe local_company corr_submp##home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id sector_year loan_type) vce(cluster ttl_project_id)
estimates store m16, title()

estfe . m13 m14 m15 m16, labels(ttl_id "TTL fixed effects" sector_year "Sector-year fixed effects" loan_type "Loan-type fixed effects")

esttab m13 m14 m15 m16 using GovA2.rtf, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(4) ///
se r2 label  indicate(`r(indicate_fe)') 

********************************
* Table A3: Country experience *
********************************

reghdfe local_company log_cexp  if ncb==0, absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m17, title()

reghdfe local_company log_cexp ca_admin_capacity pr_admin_capacity log_price log_amount if ncb==0, absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m18, title()

reghdfe local_company log_cexp ca_admin_capacity pr_admin_capacity log_price log_amount if ncb==0, absorb(ttl_id sector_year loan_type) vce(cluster ttl_project_id)
estimates store m19, title()

reghdfe local_company log_cexp ca_admin_capacity pr_admin_capacity log_price log_amount if ncb==0, absorb(ttl_id sector_year loan_type cntry_year) vce(cluster ttl_project_id)
estimates store m20, title()

estfe . m17 m18 m19 m20, labels(ttl_id "TTL fixed effects" sector_year "Sector-year fixed effects" loan_type "Loan-type fixed effects")

esttab m17 m18 m19 m20 using GovA3.rtf, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(4) ///
se r2 label  indicate(`r(indicate_fe)') 


********************************
* Table A4: Bidding procedures *
********************************

*procedures
reghdfe local_company home_country , absorb(ttl_id loan_type selection_type) vce(cluster ttl_project_id)
estimates store m21, title()

reghdfe local_company home_country ca_admin_capacity pr_admin_capacity log_price log_amount , absorb(ttl_id loan_type selection_type) vce(cluster ttl_project_id)
estimates store m22, title()

reghdfe local_company home_country ca_admin_capacity pr_admin_capacity log_price log_amount, absorb(ttl_id sector_year loan_type selection_type) vce(cluster ttl_project_id)
estimates store m23, title()

reghdfe local_company home_country ca_admin_capacity pr_admin_capacity log_price log_amount, absorb(ttl_id sector_year loan_type cntry_year selection_type) vce(cluster ttl_project_id)
estimates store m24, title()

estfe . m21 m22 m23 m24, labels(ttl_id "TTL fixed effects" sector_year "Sector-year fixed effects" cntry_year "Country-year fixed effects" loan_type "Loan-type fixed effects" selection_type "Selection-type fixed effects")

esttab m21 m22 m23 m24 using GovA4.rtf, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(4) ///
se r2 label  indicate(`r(indicate_fe)') 

**********************************************
* Table A5: Excluding NCB & national shopping*
**********************************************

*NCB
reghdfe local_company home_country  if ncb==0, absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m25, title()

reghdfe local_company home_country ca_admin_capacity pr_admin_capacity log_price log_amount if ncb==0, absorb(ttl_id loan_type) vce(cluster ttl_project_id)
estimates store m26, title()

reghdfe local_company home_country ca_admin_capacity pr_admin_capacity log_price log_amount if ncb==0, absorb(ttl_id sector_year loan_type) vce(cluster ttl_project_id)
estimates store m27, title()

reghdfe local_company home_country ca_admin_capacity pr_admin_capacity log_price log_amount if ncb==0, absorb(ttl_id sector_year loan_type cntry_year) vce(cluster ttl_project_id)
estimates store m28, title()

estfe . m25 m26 m27 m28 , labels(ttl_id "TTL fixed effects" sector_year "Sector-year fixed effects" loan_type "Loan-type fixed effects")

esttab m25 m26 m27 m28 using GovA5.rtf, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(4) ///
se r2 label  indicate(`r(indicate_fe)') 

******************************
* Table A6: Conditional logit*
******************************

clogit local_company home_country ca_admin_capacity pr_admin_capacity log_price log_amount  i.loan_type_fe i.sector_fe if ncb==0, group(ttl_id) vce(cluster ttl_id) iter(50)
estimates store m29, title(Clogit)

clogit corr_proc home_country ca_admin_capacity pr_admin_capacity log_price log_amount  i.loan_type_fe i.sector_fe if ncb==0, group(ttl_id) vce(cluster ttl_id) iter(50)
estimates store m30, title(Clogit)

clogit local_company corr_proc##c.home_country ca_admin_capacity pr_admin_capacity log_price log_amount i.loan_type_fe i.sector_fe if ncb==0, group(ttl_id) vce(cluster ttl_id) iter(50)
estimates store m31, title(Clogit)

esttab m29 m30 m31 using govA6.rtf, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) b(4) ///
se pr2 label  indicate( "loan-type-fixed-effects=*loan_type_fe" "sector-fixed-effects=*sector_fe") 
